Get("Date Last Modified"); if ($Modified == "0000-00-00 00:00:00") { $Modified = "—"; } else { $MUser = $Item->Get("Last Modified By Id", true); $MUser = array_shift($MUser); $Modified = StdLib::getPrettyTimestamp($Modified) ." - ".(($MUser instanceof User) ? $MUser->Name() : "(unknown)").""; $Modified = str_replace(" ", " ", $Modified); } return $Modified; } # set up links $BaseLink = "index.php?P=P_Pages_ListPages&CK=".$H_ListChecksum; $AddPageLink = "index.php?P=P_Pages_EditPage&ID=NEW"; $PageDisplayLink = "index.php?P=P_Pages_DisplayPage&ID=\$ID"; $PageEditLink = "index.php?P=P_Pages_EditPage&ID=\$ID"; $PageDeleteLink = "index.php?P=P_Pages_DeletePage&ID=\$ID"; # get singleton objects $AnonUser = User::getAnonymousUser(); $AF = ApplicationFramework::getInstance(); # set up fields to display $Fields = [ "Pages: Viewable" => [ "Heading" => "", "ValueFunction" => function ($Item) use ($AnonUser, $AF) { $EyeSlashLink = $AF->guiFile("EyeSlash.svg"); return $Item->userCanView($AnonUser) ? "" : ""; } ], "Pages: Title" => [ "Heading" => "Title", "Link" => $PageDisplayLink, "MaxLength" => 40 ], "Pages: Clean URL" => [ "Heading" => "URL", "Link" => $PageDisplayLink ], "Pages: Date Last Modified" => [ "Heading" => "Modified", "ValueFunction" => "GetLastModifiedText", "DefaultSortField" => true, "DefaultToDescendingSort" => true ], ]; # create and display list UI $ListUI = new ItemListUI($Fields, $H_TransportUI); $ListUI->heading("Page List"); $ListUI->itemsPerPage($H_PagesPerPage); $ListUI->baseLink($BaseLink); $ListUI->itemTypeName("Page"); $ListUI->addTopButton("Add New Page", $AddPageLink, "add_field.png"); $ListUI->addActionButton("Edit", $PageEditLink, "pencil.png"); $ListUI->addActionButton("Delete", $PageDeleteLink, "cross.png"); $ListUI->display($H_Pages, $H_PageCount, $H_StartingIndex);